<template>
    <div class="LevHome" ref="LevHomeRef">
        <div class="LevHome_lef">
            <el-menu
                default-active="2"
                class="el-menu-vertical-demo"
                @open="handleOpen"
                @close="handleClose"
                background-color="#2A3C5A"
                text-color="#D3DAEA"
                active-text-color="#5682F3"
                :unique-opened="true"
            >
                <el-submenu v-for="(item, index) in moutend" :key="index" :index="item.moduleName">
                    <template slot="title">
                        <i class="el-icon-location"></i>
                        <span style="font-size: '24px'">{{ item.moduleName }}</span>
                    </template>
                    <el-menu-item-group v-for="(v, i) in item.childNode" :key="i">
                        <router-link to="/SubList">
                            <el-menu-item :index="v.moduleName" @click="changeAlnext(v)">{{ v.moduleName }}</el-menu-item>
                        </router-link>
                    </el-menu-item-group>
                </el-submenu>
            </el-menu>
        </div>
        <div class="LevHome_rig">
            <router-view ref="SubPage" :loading.sync="loading"></router-view>
        </div>
    </div>
</template>
<script>
import bus from '@/components/common/bus';
import { GetModuleTreeData } from '@/api/index';
export default {
    name: 'LevHome',
    data() {
        return {
            moutend: [],
            loading: true,
            back: null
        };
    },
    mounted() {
        bus.$on('up', (item) => {
            this.moutend = item;
        });
    },
    methods: {
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        },
        changeAlnext(v) {
            sessionStorage.setItem('tableId', v.tableId);
            setTimeout(() => {
                this.$refs.SubPage.GetHeaderFun(v.tableId);
            }, 200);
        }
    }
};
</script>
<style lang="less" scoped>
.LevHome {
    height: 100%;
    display: flex;
    .LevHome_lef {
        width: 240px;
        height: 100%;
        ul {
            height: 100%;
        }
    }
    .LevHome_rig {
        width: calc(100% - 230px);
        padding: 15px;
        box-sizing: border-box;
        margin-bottom: 30px;
    }
}
</style>